from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import time

browser = webdriver.Firefox() # Get local session of fire
browser.set_window_size(1080,990)
browser.get("http://192.168.1.208:8085/") # Load page

ad = browser.find_element_by_xpath('html/body/div[3]/div/div[2]/span')
if ad:
    ad.click()

wode = browser.find_element_by_xpath("html/body/div[1]/footer/div/a[4]")
wode.click()

username = browser.find_element_by_id('username')
username.send_keys(18200000022)
password =  browser.find_element_by_id('password')
password.send_keys('abcd@1234')
login = browser.find_element_by_id('login_a')
login.click()

cz = browser.find_element_by_id('cz-btn')
cz.click()
money = browser.find_element_by_id('money')
money.send_keys(1000)
chongzhi = browser.find_element_by_xpath('html/body/div[1]/div[2]/input')
chongzhi.click()
assert 'https://test.pay.sina.com.cn/cashdesk-web/view/recharge.html' in browser.current_url

#yanzhengma = browser.find_element_by_xpath(".//*[@id='BindingPay']/div[3]/div[1]/a")
yanzhengma = browser.find_element_by_class_name('J-sendsms')[0]
yanzhengma.click()
browser.implicitly_wait(60)
sinamima = browser.find_element_by_id('J-payPwd_BindingPay')
sinamima.send_keys('abcd@1234')
chenggong = browser.find_element_by_xpath(".//*[@id='BindingPay']/div[6]/div/button")
chenggong.click()


#browser.close()
